﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using bus.console.service.bus.vo;
using System.Web.Script.Serialization;
using web.ui.Service_BusFeedback;
using com.console.generic.util;


public partial class Service_BusFeedback : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) 
        {
            doAction();
        }
    }

    private void doAction()
    {
        String obj_id = Request.QueryString["obj_id"];
        String member_id = Request.QueryString["member_id"];
        String eventStr = Request.QueryString["event"];
        String event_id = Request.QueryString["event_id"];
        String point = Request.QueryString["point"];
        String content = Request.QueryString["content"];

        if (!String.IsNullOrEmpty(obj_id) && !String.IsNullOrEmpty(member_id) && !String.IsNullOrEmpty(eventStr) && !String.IsNullOrEmpty(point))
        {
            BusFeedbackVO vo = new BusFeedbackVO();

            vo.ID = Guid.NewGuid().ToString();
            vo.MemberID = member_id;
            vo.EventID = event_id;
            vo.EventType = eventStr;
            vo.Point = ConvertUtil.ToInt32(point);
            vo.Content = content;
            busService.myService.DaoInsert(vo);
            vo.InsDT = DateTime.Now;
            vo.UpdDT = DateTime.Now;
            busService.myService.Dao.DaoInsert(vo);
            
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            ResultShowVO feedback = new ResultShowVO();
            FeedbackShowVO f = new FeedbackShowVO();
            f.status = true;
            feedback.feedback = f;
            String json = serializer.Serialize(feedback);
            Response.Write(json);
            Response.End();
        }
        else 
        {
            ResultShowVO feedback = new ResultShowVO();
            FeedbackShowVO f = new FeedbackShowVO();
            f.status = false;
            feedback.feedback = f;
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            String json = serializer.Serialize(feedback);
            Response.Write(json);
            Response.End();
        }
    }

  

   
}
namespace web.ui.Service_BusFeedback
{
    class ResultShowVO 
    {
        public FeedbackShowVO feedback { get; set; }
    }

    class FeedbackShowVO
    {
        public bool status { get; set; }
    }

}